using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FrameWork.Source.Global_variables;

namespace FrameWork.Source.Utilities
{
    class CUtilities
    {
        private static CUtilities m_pUtilities = null;

        private Random m_pRandom;

        private CUtilities()
        {
            DateTime time = DateTime.Now;
            m_pRandom = new Random(time.Millisecond);
        }

        public static CUtilities getInstance()
        {
            if (m_pUtilities == null)
            {
                m_pUtilities = new CUtilities();
            }

            return m_pUtilities;
        }

        

        public int randomNumber( int min, int max)
        {
            return m_pRandom.Next(min, max);
        }


        public double linearVelocityX(double angle)
        {
            angle -= 90;
            if (angle <= 0)
                angle = 360 + angle;

            return Math.Cos(angle * Math.PI / 180);
        }

        public double linearVelocityY(double angle)
        {
            angle -= 90;
            if (angle <= 0)
                angle = 360 + angle;

            return Math.Sin(angle * Math.PI / 180);
        }
    }
}
